//
//  HomeTabBarController.m
//  HYSmileiOS
//
//  Created by alekye on 16/4/23.
//  Copyright © 2016年 heyou. All rights reserved.
//

#import "HomeTabBarController.h"
#import "SettingViewController.h"

@interface HomeTabBarController ()
- (IBAction)onCancelButtonClick:(id)sender;
- (IBAction)onSettingButtonClick:(id)sender;

@end

@implementation HomeTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
    NSLog(@"item = %@, index = %ld", item, item.tag);
    NSInteger nTag = item.tag;
    if (nTag == 0) {
        self.title = @"首页";
    } else if (nTag == 1) {
        self.title = @"我的";
    } else if (nTag == 2) {
        self.title = @"";
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)onCancelButtonClick:(id)sender {
    [self.navigationController dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)onSettingButtonClick:(id)sender {
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Home" bundle:nil];
    NSString *identifier = NSStringFromClass([SettingViewController class]);
    SettingViewController *vc = [storyBoard instantiateViewControllerWithIdentifier:identifier];
    [self.navigationController pushViewController:vc animated:YES];
}
@end
